<template>
  <view class="complaint-feedback-web-view">
    <bg-set background="#f2f3f7" />
    <web-view
      class="complaint-feedback-web-view__main"
      :update-title="false"
      :src="url"
      :webview-styles="webviewStyles"
    ></web-view>
  </view>
</template>

<script>
import profileAPI from "/api/modules/profile";
var wv; //计划创建的webview
export default {
  name: "complaint-feedback-web-view",
  data() {
    return {
      complaintType: "",
      url: "",
      webviewStyles: {
        progress: false,
      },
    };
  },
  onLoad(option) {
    this.complaintType = option.complaintType;
    this.url = `${profileAPI.pageBaseURL}/#/pages/profile/feedback/complaint-feedback-submit?complaintType=${this.complaintType}`;
  },
  onReady() {
    // 处理web-view位置
    // #ifdef APP-PLUS
    var currentWebview = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
    setTimeout(function () {
      wv = currentWebview.children()[0];
      wv.setStyle({ top: 84, height: 700 });
    }, 1000); //如果是页面初始化调用时，需要延时一下
    // #endif
  },
};
</script>
<style lang='scss' scoped>
.complaint-feedback-web-view {
  width: 100%;
  height: 100vh;
}
</style>